# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union, Dict


class PayEnum:
    # 支付方式
    WAY_BALANCE = 1  # 余额支付
    WAY_MNP = 2      # 微信支付
    WAY_ALI = 3      # 支付宝支付

    # 支付状态
    PAID_NO = 0  # 待支付
    PAID_OK = 1  # 待支付

    # 退款状态
    REFUND_NO = 0    # 未退款
    REFUND_ING = 1   # 退款中
    REFUND_OK = 2    # 退款成功
    REFUND_FAIL = 3  # 退款失败

    @classmethod
    def get_pay_way_msg(cls, code) -> Union[str, Dict[int, str]]:
        """ 支付方式描述 """
        _desc = {
            cls.WAY_BALANCE: "余额支付",
            cls.WAY_MNP: "微信支付",
            cls.WAY_ALI: "支付宝支付"
        }
        if isinstance(code, bool) and code:
            return _desc
        return _desc.get(code, "")

    @classmethod
    def get_pay_status_msg(cls, code) -> Union[str, Dict[int, str]]:
        """ 支付状态描述 """
        _desc = {
            cls.PAID_NO: "待支付",
            cls.PAID_OK: "已支付"
        }
        if isinstance(code, bool) and code:
            return _desc
        return _desc.get(code, "")

    @classmethod
    def get_refund_status_msg(cls, code) -> Union[str, Dict[int, str]]:
        """ 退款状态描述 """
        _desc = {
            cls.REFUND_NO: "未退款",
            cls.REFUND_ING: "退款中",
            cls.REFUND_OK: "退款成功",
            cls.REFUND_FAIL: "退款失败"
        }
        if isinstance(code, bool) and code:
            return _desc
        return _desc.get(code, "")
